<?php if($userOrder):?>
<div class="show_orders">
    <div class="col2-set order-info-box">
        <div class="col-1">
           <div class="box">
                <div class="box-title">
                    <h3>Shipping Address</h3>
                </div>
                <div class="box-content">
                    <address><?php echo _tag('div',_tag('label','Full Name').$userOrder->DmUser->Profile->first_name.' '.$userOrder->DmUser->Profile->last_name); ?>
                            <?php echo _tag('div',_tag('label','Address').$userOrder->DmUser->Profile->street_address1.', '.$userOrder->DmUser->Profile->street_address2); ?>
                            <?php echo _tag('div',_tag('label','City').$userOrder->DmUser->Profile->city.', '.$userOrder->DmUser->Profile->post_code) ?>
                            <?php echo _tag('div',_tag('label','Country').$userOrder->DmUser->Profile->country); ?>
                            <?php echo _tag('div',_tag('label','Contact Number').$userOrder->DmUser->Profile->phone_no); ?>
                    </address>
                </div>
            </div>
        </div>
        <div class="col-2">
            <div class="about_order">
                <div class="title">About This Order</div>
                <div class="content">
                    <?php echo _tag('div',_tag('label','Order Information').($userOrder->id+1000000).': '.$userOrder->status); ?>
                    <?php echo _tag('div',_tag('label','Order Date').date('F d, Y',strtotime($userOrder->created_at))) ?>
                </div>
            </div>
            
        </div>
    </div>
    <div class="order-items order-details">
        <div class="box">
            <div class="box-title">
                <h3 class="table-caption">Items Ordered</h3>
            </div>
        <table class="data-table" id="my-orders-table" summary="Items Ordered">
            <col>
            <col width="1">
            <col width="1">
            <col width="1">
            <col width="1">
            <thead>
                <tr class="first last">
                    <th>Product Name</th>
                    <th>Category Name </th>
                    <th class="a-right">Price(BDT)</th>
                    <th class="a-center">Qty</th>
                    <th class="a-right">Subtotal(BDT)</th>
                </tr>
            </thead>
            <tbody class="odd">
                    <?php $subtotal = 0;
    foreach($userOrder->CustomarOrderProducts as $customarOrderProduct):?>
                <tr class="border first last" id="order-item-row-4">
                    <td><h3 class="product-name"><?php echo $customarOrderProduct->Product->name; ?></h3></td>
                    <td><?php echo $customarOrderProduct->Product->ProductCategory; ?></td>
                    <td class="a-right">
                        <span class="price"><?php echo $customarOrderProduct->unit_cost; ?></span>
                        <br>
                    </td>
                    <td class="a-right">
                        <span class="nobr"><strong><?php echo $customarOrderProduct->quantity; ?></strong><br></span>
                    </td>
                    <td class="a-right last">
                        <span class="price"><?php
                                    $subtotal+= ($customarOrderProduct->unit_cost*$customarOrderProduct->quantity);
        echo $subtotal; ?></span>
                        <br>
                    </td>
                </tr>
    <?php endforeach;?>
            </tbody>
            <tfoot>
                <tr class="subtotal first">
                    <td colspan="4" class="a-right">Subtotal</td>
                    <td class="last a-right"><span class="price">BDT: <?php echo $subtotal; ?></span></td>
                </tr>
                <tr class="cod_fee">
                    <td colspan="4" class="a-right"><?php echo $userOrder->UserPaymentInfo->PaymentMethod->title; ?></td>
                    <td class="last a-right"><span class="price">BDT: 0.00</span></td>
                </tr>
                <tr class="shipping">
                    <td colspan="4" class="a-right">Shipping &amp; Handling</td>
                    <td class="last a-right"><span class="price">BDT: <?php echo ($userOrder->total_cost-$subtotal); ?></span></td>
                </tr>
                <tr class="grand_total last">
                    <td colspan="4" class="a-right"><strong>Grand Total(BDT)</strong></td>
                    <td class="last a-right"><strong><span class="price"><?php echo $userOrder->total_cost; ?></span></strong></td>
                </tr>
            </tfoot>
        </table>
        </div>
        <div class="buttons-set">
            <p class="back-link">
    <?php echo _link('main/myOrders')->text('Back to My Orders')?>

            </p>
        </div>
    </div>
</div>
<?php else:?>
<div> No order found.</div>
<?php endif;?>

